package com.fr.report.core;

import com.fr.base.core.FT;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.report.ArrayPageSet;
import com.fr.report.CellElement;
import com.fr.report.FloatElement;
import com.fr.report.PageInfo;
import com.fr.report.PageSet;
import com.fr.report.PaperSetting;
import com.fr.report.RWorkSheet;
import com.fr.report.ReportPage;
import com.fr.report.ReportSettings;
import com.fr.report.ResultReport;
import com.fr.report.io.xml.ReportXMLUtils;
import com.fr.util.Utils;
import java.util.Iterator;

public class PaginateReport extends PackedReport
{
  private transient int[] oi_row_int_list;
  private transient int[] oi_column_int_list;

  public PaginateReport()
  {
    super(null);
  }

  public PaginateReport(ResultReport paramResultReport, int[] paramArrayOfInt1, int[] paramArrayOfInt2)
  {
    super(paramResultReport);
    this.oi_row_int_list = paramArrayOfInt1;
    this.oi_column_int_list = paramArrayOfInt2;
  }

  public int[] get_row_oi_int_list()
  {
    return this.oi_row_int_list;
  }

  public int[] get_col_oi_int_list()
  {
    return this.oi_column_int_list;
  }

  public PageSet generateReportPageSet(PaperSetting paramPaperSetting)
  {
    if ((paramPaperSetting != null) && (ReportUtils.getReportSettings(this.packee).isLonelyPage()))
    {
      FT localFT1 = new FT(0, getColumnCount());
      FT localFT2 = new FT(0, getRowCount());
      return new ArrayPageSet(new ReportPage[] { new ReportPage(this.packee, new PageInfo(1), null, new FT[] { localFT2 }, new FT[] { localFT1 }, 1, 1) }, false);
    }
    return new ArrayPageSet(new PaginateReportPageGenerator(this, paramPaperSetting).getReportPages(), false);
  }

  public RWorkSheet toRWorkSheet()
  {
    return ((RWorkSheet)this.packee);
  }

  public void addCellElement(CellElement paramCellElement)
  {
    this.packee.addCellElement(paramCellElement);
  }

  public void addCellElement(CellElement paramCellElement, boolean paramBoolean)
  {
    this.packee.addCellElement(paramCellElement, paramBoolean);
  }

  public void addFloatElement(FloatElement paramFloatElement)
  {
    this.packee.addFloatElement(paramFloatElement);
  }

  public void bringFloatElementForward(FloatElement paramFloatElement)
  {
    this.packee.bringFloatElementForward(paramFloatElement);
  }

  public void bringFloatElementToFront(FloatElement paramFloatElement)
  {
    this.packee.bringFloatElementToFront(paramFloatElement);
  }

  public Iterator cellIterator()
  {
    return this.packee.cellIterator();
  }

  public Iterator floatIterator()
  {
    return this.packee.floatIterator();
  }

  public CellElement getCellElement(int paramInt1, int paramInt2)
  {
    return this.packee.getCellElement(paramInt1, paramInt2);
  }

  public Object getCellValue(int paramInt1, int paramInt2)
  {
    return this.packee.getCellValue(paramInt1, paramInt2);
  }

  public Iterator getColumn(int paramInt)
  {
    return this.packee.getColumn(paramInt);
  }

  public int getColumnCount()
  {
    return this.packee.getColumnCount();
  }

  public FloatElement getFloatElement(String paramString)
  {
    return this.packee.getFloatElement(paramString);
  }

  public Iterator getRow(int paramInt)
  {
    return this.packee.getRow(paramInt);
  }

  public int getRowCount()
  {
    return this.packee.getRowCount();
  }

  public void insertColumn(int paramInt)
  {
    this.packee.insertColumn(paramInt);
  }

  public void insertRow(int paramInt)
  {
    this.packee.insertRow(paramInt);
  }

  public Iterator intersect(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    return this.packee.intersect(paramInt1, paramInt2, paramInt3, paramInt4);
  }

  public void merge(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    this.packee.merge(paramInt1, paramInt2, paramInt3, paramInt4);
  }

  public void removeAllCellElements()
  {
    this.packee.removeAllCellElements();
  }

  public void removeAllFloatElements()
  {
    this.packee.removeAllFloatElements();
  }

  public boolean removeCellElement(CellElement paramCellElement)
  {
    return this.packee.removeCellElement(paramCellElement);
  }

  public CellElement removeCellElement(int paramInt1, int paramInt2)
  {
    return this.packee.removeCellElement(paramInt1, paramInt2);
  }

  public void removeColumn(int paramInt)
  {
    this.packee.removeColumn(paramInt);
  }

  public FloatElement removeFloatElement(String paramString)
  {
    return this.packee.removeFloatElement(paramString);
  }

  public boolean removeFloatElement(FloatElement paramFloatElement)
  {
    return this.packee.removeFloatElement(paramFloatElement);
  }

  public void removeRow(int paramInt)
  {
    this.packee.removeRow(paramInt);
  }

  public void sendFloatElementBackward(FloatElement paramFloatElement)
  {
    this.packee.sendFloatElementBackward(paramFloatElement);
  }

  public void sendFloatElementToBack(FloatElement paramFloatElement)
  {
    this.packee.sendFloatElementToBack(paramFloatElement);
  }

  public void setCellValue(int paramInt1, int paramInt2, Object paramObject)
  {
    this.packee.setCellValue(paramInt1, paramInt2, paramObject);
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str1;
      String[] arrayOfString;
      int i;
      String str2 = paramXMLableReader.getTagName();
      if (str2.equals("OIRowIntList"))
      {
        if ((str1 = paramXMLableReader.getElementValue()) == null)
          return;
        arrayOfString = Utils.splitString(str1, ',');
        this.oi_row_int_list = new int[arrayOfString.length];
        i = 0;
        while (true)
        {
          if (i >= arrayOfString.length)
            return;
          if ((arrayOfString[i] != null) && (arrayOfString[i].length() > 0))
            this.oi_row_int_list[i] = Integer.parseInt(arrayOfString[i]);
          ++i;
        }
      }
      if (str2.equals("OIColumnIntList"))
      {
        if ((str1 = paramXMLableReader.getElementValue()) == null)
          return;
        arrayOfString = Utils.splitString(str1, ',');
        this.oi_column_int_list = new int[arrayOfString.length];
        i = 0;
        while (true)
        {
          if (i >= arrayOfString.length)
            return;
          if ((arrayOfString[i] != null) && (arrayOfString[i].length() > 0))
            this.oi_column_int_list[i] = Integer.parseInt(arrayOfString[i]);
          ++i;
        }
      }
      if (str2.equals("Report"))
        this.packee = ((ResultReport)paramXMLableReader.readXMLObject(ReportXMLUtils.readReportFromClassName(paramXMLableReader.getAttr("class"))));
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("OIRowIntList");
    StringBuffer localStringBuffer1 = new StringBuffer();
    int i = 0;
    int j = this.oi_row_int_list.length;
    while (i < j)
    {
      if (i != 0)
        localStringBuffer1.append(",");
      localStringBuffer1.append(this.oi_row_int_list[i]);
      ++i;
    }
    paramXMLPrintWriter.textNode(localStringBuffer1.toString());
    paramXMLPrintWriter.end();
    paramXMLPrintWriter.startTAG("OIColumnIntList");
    StringBuffer localStringBuffer2 = new StringBuffer();
    j = 0;
    int k = this.oi_column_int_list.length;
    while (j < k)
    {
      if (j != 0)
        localStringBuffer2.append(",");
      localStringBuffer2.append(this.oi_column_int_list[j]);
      ++j;
    }
    paramXMLPrintWriter.textNode(localStringBuffer2.toString());
    paramXMLPrintWriter.end();
    paramXMLPrintWriter.startTAG("Report").attr("class", this.packee.getClass().getName());
    this.packee.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    PaginateReport localPaginateReport = (PaginateReport)super.clone();
    return localPaginateReport;
  }
}